PlaywrightのSnapshot Testing
from Snapshot Testing
Playwright
https://playwright.dev/docs/test-snapshots
https://playwright.dev/docs/api/class-snapshotassertions
code:ts
import { test, expect } from '@playwright/test';
test('example test', async ({ page }) => {
await page.goto('https://playwright.dev');
await expect(page).toHaveScreenshot();
});
code:ts
import { test, expect } from '@playwright/test';
test('example test', async ({ page }) => {
await page.goto('https://playwright.dev');
expect(await page.textContent('.hero__title')).toMatchSnapshot('hero.txt');
});
https://zenn.dev/adwd/articles/72f8d4734264e5